<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件的嵌套</title>
</head>
<body>
<div id="root">
    <school></school>

</div>

<script src="../script/vue.js"></script>

<script>
    let student = Vue.extend({
        name: 'student',
        template: '<div>' +
            '<h2>学生姓名{{studentName}}</h2>' +
            '<h2>学生学号{{studentNum}}</h2>' +
            '</div>',
        data() {
            return {
                studentName: '张三',
                studentNum: '14654897894984'
            }
        }
    });

    let school = Vue.extend({
        name: 'school',
        template: '<div>' +
                        '<h2>学校名称{{schoolName}}</h2>' +
                        '<h2>学校地址{{schoolAddress}}</h2>' +
                        '<student></student>' +
                  '</div>',
        data() {
            return {
                schoolName: '北京大学',
                schoolAddress: '北京'
            }
        },
        components: {
            student
        }
    });

    let vm = new Vue({
        el: '#root',
        components: {
            school
        }
    });

</script>

</html>